#pragma once
#include"HashTable.h"

namespace zxf
{
	template<class K,class Hash= hash_bucket::HashFunc<K>>
	class unordered_set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename hash_bucket::Hashtable<K, K, SetKeyOfT, Hash>::iterator iterator;
		iterator begin()
		{
			return _ht.begin();
		}
		iterator end()
		{
			return _ht.end();
		}

		bool insert(const K& key)
		{
			return _ht.Insert(key);
		}

	private:
		hash_bucket::Hashtable<K,K,SetKeyOfT,Hash> _ht;

	};
	void test_set1()
	{
		unordered_set<int> s;
		s.insert(3);
		s.insert(1);
		s.insert(5);
		s.insert(7);

		unordered_set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;

	}
}
